package com.st.controller;


import com.st.entity.*;
import com.st.service.IAttractionsService;
import com.st.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private IOrderService iOrderService;
    @Autowired
    private IAttractionsService iAttractionsService;

    @PostMapping("/delOne")
    public Result delByIds(@RequestBody Order order){
        return iOrderService.delOne(order);
    }

    @PostMapping("/attractionList")
    public List<Attractions> findAll(){
        return iAttractionsService.findAll1();
    }
    @PostMapping("/search")
    public PageResult<Order> search(@RequestBody PageDTO<Order> pageDTO){
        if (pageDTO == null) {
            pageDTO.setPage(1);
            pageDTO.setLimit(5);
        }
        return iOrderService.findOrders(pageDTO);
    }

}
